/**
 */
import {getAction, postAction} from '@/api/manage'

export const butStatus = {
  data() {
    return {
      typeText: '',
    }
  },
  created() {
  },
  mounted() {
  },
  methods: {
    // 提交审核-打开选择审核人弹窗
    showConfirm() {
      if (this.selectedRowKeys.length == 0) {
        this.$message.warning("请选择数据!")
        return
      }
      this.$refs.approver.showApproveConfirm = true
    },
    // 提交审核
    handleSubmit(userId) {
      getAction(this.url.submit, {
        proId: this.id,
        typeText: '0',
        ids: this.selectedRowKeys.toString(),
        userId: userId,
        typeId: this.thisTypeId
      }).then((res) => {
        if (res.success) {
          this.$message.success(res.message)
          this.loadData()
          this.list1()
        } else {
          this.$message.error(res.message)
        }
      })
    },
    // 填写审核原因
    setApproveReason(status) {
      if (this.selectedRowKeys.length == 0) {
        this.$message.warning("请选择数据!")
        return
      }
      this.typeText = status
      // this.$refs.setReason.show()
      this.approveData()
    },
    // 同意拒绝
    approveData(reason) {
      getAction(this.url.approve, {
        proId: this.id,
        ids: this.selectedRowKeys.toString(),
        typeText: this.typeText,
        typeId: this.thisTypeId
      }).then((res) => {
        if (res.success) {
          this.$refs.setReason.setApproveReason = false
          this.loadData()
        } else {
          this.$message.error(res.message)
        }
      })
    },
  }

}